class Person {
    name: string
    age: number
    constructor(name: string, age: number) {
        this.name = name
        this.age = age
    }
    speak() {
        console.log(`我叫${this.name}，今年${this.age}岁`)
    }
}

const p1 = new Person('wbw', 18)
p1.speak()

class Student extends Person {
    grade: string
    constructor(name: string, age: number, grade: string) {
        super(name, age)
        this.grade = grade
    }
    study() {
        console.log(`${this.name}正在努力学习`)
    }
    // 覆写父类的这个方法
    override speak() {
        console.log(`我是学生叫${this.name}，今年${this.age}岁`)
    }
}

const s1 = new Student('李四', 16, '高三')
s1.study()
s1.speak()
